package org.pms.demo.webservice.dao.pms;

import org.apache.ibatis.annotations.Param;
import org.pms.demo.webservice.domain.Resource;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by xusaike on 17/6/14.
 */
@Component
public interface ResourceMapper {
    /**
     * 根据用户名获取相关权限
     * @param user_name
     * @return
     */
    public List<Resource> getResourceByUser(@Param("user_name")String user_name);

    /**
     * 获取所有资源
     * @return
     */
    public List<Resource> getAllResource();

    /**
     * 根据app_id获取资源
     * @param app_id
     * @return
     */
    public List<Resource> getResourceTreeByAppid(@Param("app_id")int app_id);

    /**
     * 根据id获取节点
     * @param id
     * @return
     */
    public Resource getResourceById(@Param("id")int id);
    public List<Resource> getResourceByPId(@Param("id")int id);

    /**
     * 添加节点
     * @param resource
     * @return
     */
    public int addResource(Resource resource);

    /**
     * 修改节点
     * @param resource
     * @return
     */
    public int updateResource(Resource resource);


    /**
     * 删除节点
     * @param id
     * @return
     */
    public int deleteResource(@Param("id")int id);

}
